export function uniqueByReduce(arr, key) {
  return arr.reduce((acc, current) => {
    if (!acc.find((item) => item[key] === current[key])) {
      acc.push(current);
    }
    return acc;
  }, []);
}

export function uniqueByMap(arr, key) {
  const seen = new Map();
  return arr.filter(
    (item) => !seen.has(item[key]) && seen.set(item[key], true),
  );
}
